import Vue from 'vue'
import Router from 'vue-router'

import Layout from '../views/layout/Layout'

Vue.use(Router)

// var _import = file => require('@/views/' + file + '.vue').default;
var _import = file => {
  return () => System.import('@/views/' + file + '.vue')
}


export const constantRouterMap = [
  {
  title: '系统管理',
  name: 'goods',
  children: [
    {
      path: '/brand22',
      component: Layout,
      meta: {
        title: '权限管理',
        icon: 'dashboard'
      },
      children: [{
        path: 'index',
        component: _import('goods_brand/index'),
        meta: {
          title: '管理员管理',
          icon: 'dashboard'
        },
      },
      {
        path: 'tag',
        component: _import('goods_tag/index'),
        meta: {
          title: '管理员添加',
          icon: 'dashboard'
        }
      },

      {
        path: 'oplog',
        component: _import('goods_brand/log'),
        meta: {
          title: '管理员登陆日志',
          icon: 'dashboard'
        }
      }
      ]
    },
    {
      path: '/role',
      name: 'role:manage',
      component: Layout,
      meta: {
        title: '角色管理',
        icon: 'dashboard'
      },
      children: [{
          path: 'index',
          name: 'role:rolelist',
          component: _import('role/index'),
          meta: {
            title: '角色列表',
            icon: 'dashboard'
          }
        },
        {
          path: 'role_add',
          name: 'role_add:manage',
          component: _import('role/role_add'),
          meta: {
            title: '角色添加',
            icon: 'dashboard'
          }
        },
      ]
    },

    {
      path: '/manage_info',
      name: 'manage_info:manage',
      component: Layout,
      meta: {
        title: '当前管理员管理',
        icon: 'dashboard'
      },
      children: [{
          path: 'index',
          name: 'manage_info:goodslist',
          component: _import('manage_info/index'),
          meta: {
            title: '个人资料管理',
            icon: 'dashboard'
          }
        },
        {
          path: 'pass_manage',
          name: 'pass_manage:manage',
          component: _import('manage_info/pass_manage'),
          meta: {
            title: '密码管理',
            icon: 'dashboard'
          }
        },
        {
          path: 'manage_log',
          name: 'manage_log:manage',
          component: _import('manage_info/log'),
          meta: {
            title: '登陆日志',
            icon: 'dashboard'
          }
        },
      ]
    },
    {
    path: '/goods',
    name: 'goods:manage',
    component: Layout,
    meta: {
      title: '基础管理',
      icon: 'dashboard'
    },
    children: [{
        path: 'index',
        name: 'goods:goodslist',
        component: _import('goods/index'),
        meta: {
          title: '后台缓存清除',
          icon: 'dashboard'
        }
      },
      {
        path: 'goods_sort',
        name: 'goods_sort:manage',
        component: _import('goods/sort_settings'),
        meta: {
          title: '数据缓存清除',
          icon: 'dashboard'
        }
      },
    ]
  },
  {
    path: '/region',
    component: Layout,
    name: 'region:main',
    meta: {
      title: '地区管理',
      icon: 'dashboard'
    },
    children: [{
        path: 'index',
        name: 'region:manage',
        component: _import('region/index'),
        meta: {
          title: '地区列表',
          icon: 'dashboard'
        }
      },
      {
        path: 'tag',
        name: 'region:manage',
        component: _import('region/add'),
        meta: {
          title: '添加地区',
          icon: 'dashboard'
        }
      },

      {
        path: 'oplog',
        name: 'region_brand:log',
        component: _import('region/log'),
        meta: {
          title: '批量添加地区',
          icon: 'dashboard'
        }
      }
    ]
  },

  {
    path: '/goodsSettings',
    name: 'goods:settings',
    component: Layout,
    meta: {
      title: 'APP版本管理',
      icon: 'dashboard'
    },
    children: [{
        path: 'category',
        name: 'goods:goods_category',
        component: _import('goods_category/index'),
        meta: {
          title: 'APP版本列表',
          icon: 'dashboard'
        }
      },
      {
        path: 'goods_type',
        name: 'goods:goods_type',
        component: _import('goods_category/add_version'),
        meta: {
          title: '添加APP版本',
          icon: 'dashboard'
        }
      },
    ]
  },
    
  ]
},
{
  title: '会员管理',
  name: 'order',
  children: [{
    path: '/order',
    name: 'order:manage',
    component: Layout,
    meta: {
      title: '融资会员',
      icon: 'dashboard'
    },
    children: [{
      path: 'index',
      name: 'order:list',
      component: _import('order_record/index'),
      meta: {
        title: '融资会员列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'order_exception',
      name: 'order_exception:list',
      component: _import('order_exception/index'),
      meta: {
        title: '融资会员添加',
        icon: 'dashboard'
      }
    },
    {
      path: 'settings',
      name: 'order:settings',
      component: _import('order_record/examineList'),
      meta: {
        title: '融资会员预审列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'goods_comments',
      name: 'order:comment',
      component: _import('goods_comments/index'),
      meta: {
        title: '融资会员核认证',
        icon: 'dashboard'
      }
    }
    ]
  },
  {
    path: '/partner_member',
    component: Layout,
    name: 'order_refund',
    meta: {
      title: '合作商会员',
      icon: 'dashboard'
    },
    children: [{
      path: 'index',
      name: 'partner:index',
      component: _import('partner_member/index'),
      meta: {
        title: '合作商会员列表',
        icon: 'dashboard'
      }
    },{
      path: 'add',
      name: 'partner:add',
      component: _import('partner_member/add'),
      meta: {
        title: '合作商会员添加',
        icon: 'dashboard'
      }
    },{
      path: 'check',
      name: 'partner:refund_money',
      component: _import('partner_member/check'),
      meta: {
        title: '合作商会员预审',
        icon: 'dashboard'
      }
    }]
  },
  {
    path: '/order-supplement',
    component: Layout,
    name: 'order-supplement:main',
    meta: {
      title: '投资会员',
      icon: 'dashboard'
    },
    children: [{
      path: 'order-supplement-apply',
      name: 'order-supplement:apply',
      component: _import('order-supplement/apply'),
      meta: {
        title: '会员列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'order-supplement-audit',
      name: 'order-supplement:audit',
      component: _import('order-supplement/audit'),
      meta: {
        title: '会员登录日志',
        icon: 'dashboard'
      }
    }
    // {
    //   path: 'order-supplement-history',
    //   name: 'order-supplement:history',
    //   component: _import('order-supplement/history'),
    //   meta: {
    //     title: '补录记录',
    //     icon: 'dashboard'
    //   }
    // }
    ]
  }
  ]
},
{
  title: '项目管理',
  name: 'user',
  children: [{
    path: '/user',
    component: Layout,
    name: 'user:manage',
    meta: {
      title: '固收黄金理财',
      icon: 'dashboard'
    },
    children: [{
      path: 'index',
      name: 'user:list',
      component: _import('user/index'),
      meta: {
        title: '项目列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'finance-add',
      name: 'finance-add',
      component: _import('finance_project/add'),
      meta: {
        title: '项目录入',
        icon: 'dashboard'
      }
    },
    {
      path: 'first_trial',
      name: 'first_trial',
      component: _import('finance_project/first_trial'),
      meta: {
        title: '项目初审',
        icon: 'dashboard'
      }
    },
    {
      path: 'review',
      name: 'review',
      component: _import('finance_project/review'),
      meta: {
        title: '项目复审',
        icon: 'dashboard'
      }
    },
    {
      path: 'staff-user',
      name: 'staff-user:list',
      component: _import('staffUser/index'),
      meta: {
        title: '发布管理',
        icon: 'dashboard'
      }
    }]
  },
  {
    path: '/feedback',
    name: 'user:feedback',
    component: Layout,
    meta: {
      title: '项目兑付',
      icon: 'dashboard'
    },
    children: [{
      path: 'goods_consult',
      name: 'goods:consult',
      component: _import('feedback/index'),
      meta: {
        title: '兑付中项目列表',
        icon: 'dashboard'
      },
    },
    {
      path: 'goods_comments',
      name: 'goods:comment',
      component: _import('goods_comments/index'),
      meta: {
        title: '已兑付项目列表',
        icon: 'dashboard'
      }
    },{
      path: 'goods_comments',
      name: 'goods:comment',
      component: _import('goods_comments/index'),
      meta: {
        title: '标的投资详情',
        icon: 'dashboard'
      }
    }
    ]
  }
  ]
},
{
  title: '资金管理',
  name: 'marketing',
  children: [{
    path: '/marketing-index',
    component: Layout,
    name: 'marketing:index',
    meta: {
      title: '投资账户管理',
      icon: 'dashboard'
    },
    children: [{
      path: 'wheel-game',
      component: _import('marketing/wheel-game'),
      name: 'wheel-game',
      meta: {
        title: '资金明细',
        icon: 'dashboard'
      }
    }
    ]
  },{
    path: '/marketing-index',
    component: Layout,
    name: 'marketing:index',
    meta: {
      title: '平台管理费',
      icon: 'dashboard'
    },
    children: [{
      path: 'wheel-game',
      component: _import('marketing/wheel-game'),
      name: 'wheel-game',
      meta: {
        title: '项目管理费列表',
        icon: 'dashboard'
      }
    }
    ]
  }]
},
{
  title: '咨讯管理',
  name: 'finance',
  children: [{
    path: '/finance',
    component: Layout,
    name: 'finance:list',
    meta: {
      title: '文章管理',
      icon: 'dashboard'
    },
    children: [{
      path: 'settled_sum',
      name: 'finance:settled_sum',
      component: _import('finance/settled_sum'),
      meta: {
        title: '文章列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'add_article',
      name: 'finance:add_article',
      component: _import('finance/add_article'),
      meta: {
        title: '添加文章',
        icon: 'dashboard'
      }
    }]
  },{
    path: '/column',
    component: Layout,
    name: 'finance:list',
    meta: {
      title: '栏目管理',
      icon: 'dashboard'
    },
    children: [{
      path: 'columnList',
      name: 'columnList:settled_sum',
      component: _import('finance/columnList'),
      meta: {
        title: '栏目列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'add_columns',
      name: 'add_columns',
      component: _import('finance/add_columns'),
      meta: {
        title: '添加栏目',
        icon: 'dashboard'
      }
    }]
  },
  {
    path: '/ad',
    component: Layout,
    name: 'ad:list',
    meta: {
      title: '专题广告管理',
      icon: 'dashboard'
    },
    children: [{
      path: 'ad_list',
      name: 'ad:ad_list',
      component: _import('finance/ad_list'),
      meta: {
        title: '广告列表',
        icon: 'dashboard'
      }
    },
    {
      path: 'add_ad',
      name: 'ad:add_ad',
      component: _import('finance/add_ad'),
      meta: {
        title: '添加广告',
        icon: 'dashboard'
      }
    }]
  },{
    path: '/help',
    component: Layout,
    name: 'finance:list',
    meta: {
      title: '帮助中心',
      icon: 'dashboard'
    },
    children: [{
      path: 'add_help',
      name: 'help:add_help',
      component: _import('finance/add_help'),
      meta: {
        title: '添加帮助',
        icon: 'dashboard'
      }
    },{
      path: 'settled_detail',
      name: 'help:settled_detail',
      component: _import('finance/settled_detail'),
      meta: {
        title: '问题内容管理',
        icon: 'dashboard'
      }
    }]
  }]
},

// {
//   title: '统计',
//   name: 'report',
//   children: [{
//     path: '/business_report',
//     component: Layout,
//     name: 'report:business_report',
//     meta: {
//       title: '零售业务统计',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'sale_count',
//       name: 'report:sale_count',
//       component: _import('business_report/sale_count'),
//       meta: {
//         title: '零售统计',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'order_count',
//       name: 'report:order_count',
//       component: _import('business_report/order_count'),
//       meta: {
//         title: '订单统计',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'sale_indicator',
//       name: 'report:sale_indicator',
//       component: _import('business_report/sale_indicator'),
//       meta: {
//         title: '商品指标分析',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'goods_sale_count',
//       name: 'report:goods_sale_count',
//       component: _import('business_report/goods_sale_count'),
//       meta: {
//         title: '商品销售排行',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'user_increase',
//       name: 'report:user_increase',
//       component: _import('business_report/user_increase'),
//       meta: {
//         title: '会员增值统计',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   },

//   {
//     path: '/customer',
//     component: Layout,
//     name: 'report:customer_report',
//     meta: {
//       title: '客户行为轨迹',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'goods_favorite',
//       name: 'report:goods_favorite',
//       component: _import('customer_report/goods_favorite'),
//       meta: {
//         title: '商品收藏统计',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'goods_cart_count',
//       name: 'report:goods_cart_count',
//       component: _import('customer_report/goods_cart_count'),
//       meta: {
//         title: '购物车商品统计',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   }
//   ]
// },

// {
//   title: '系统',
//   name: 'system',
//   children: [{
//     path: '/system',
//     component: Layout,
//     name: 'sytem:safe',
//     meta: {
//       title: '权限安全',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'admin',
//       name: 'system:admin',
//       component: _import('admin/index'),
//       meta: {
//         title: '账户管理',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'role',
//       name: 'system:role',
//       component: _import('role/index'),
//       meta: {
//         title: '角色管理',
//         icon: 'dashboard'
//       }
//     }

//     ]
//   }]
// },
// {
//   title: '油站',
//   name: 'gas_station',
//   children: [{
//     path: '/gas_station',
//     component: Layout,
//     name: 'gas_station:home',
//     meta: {
//       title: '油站管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'manage',
//       name: 'gas_station:manage',
//       component: _import('gas_station/index'),
//       meta: {
//         title: '油站管理',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'props_batch',
//       name: 'gas_station:props_batch',
//       component: _import('gas_station/props_batch'),
//       meta: {
//         title: '油站标签批量维护',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   }]
// },
// {
//   title: '运营',
//   name: 'manage',
//   children: [{
//     path: '/system',
//     component: Layout,
//     name: 'manage:manage',
//     meta: {
//       title: '运营管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'ad',
//       name: 'manage:ad',
//       component: _import('ad/index'),
//       meta: {
//         title: '广告管理',
//         icon: 'dashboard'
//       }
//     },

//       // {
//       //   path: 'message',
//       //   name: 'manage:message',
//       //   component: _import('message/index'),
//       //   meta: {
//       //     title: '消息管理',
//       //     icon: 'dashboard'
//       //   }
//       // },
//     {
//       path: 'view_counter',
//       name: 'view_counter:list',
//       component: _import('user_view_page/index'),
//       meta: {
//         title: '浏览统计',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'ui_edit',
//       name: 'ui_edit:index',
//       component: _import('ui_edit/index'),
//       meta: {
//         title: '界面自定义',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'ui_album',
//       name: 'ui_edit:album',
//       hidden: true,
//       component: _import('ui_edit/album'),
//       meta: {
//         title: '界面自定义-主题专区',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   },

//   {
//     path: '/consult',
//     component: Layout,
//     name: 'consult:manage',
//     meta: {
//       title: '咨询管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'question',
//       name: 'question:manage',
//       component: _import('question/index'),
//       meta: {
//         title: '常见问题',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'commonpage',
//       name: 'commonpage:manage',
//       component: _import('common_page/index'),
//       meta: {
//         title: '页面管理',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'feedback',
//       name: 'feedback:manage',
//       component: _import('feedback/index'),
//       meta: {
//         title: '留言反馈',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   },

//   {
//     path: '/wechat',
//     component: Layout,
//     name: 'wechat:manager',
//     meta: {
//       title: '微信管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'template_manager',
//       name: 'wechat:template_manager',
//       component: _import('wechat/template_manager'),
//       meta: {
//         title: '模板消息配置',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'menu',
//       name: 'wechat:menu',
//       component: _import('wechat/menu'),
//       meta: {
//         title: '微信菜单配置',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'auto_reply',
//       name: 'wechat:auto_reply',
//       component: _import('wechat/auto_reply'),
//       meta: {
//         title: '自动回复',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'auto_reply_history',
//       name: 'wechat:auto_reply_history',
//       component: _import('wechat/auto_reply_history'),
//       meta: {
//         title: '自动回复记录',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   },
//   {
//     path: '/untied',
//     component: Layout,
//     name: 'user_unbind:manage',
//     meta: {
//       title: '解绑管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'apply',
//       name: 'user_unbind:apply',
//       component: _import('untied/apply'),
//       meta: {
//         title: '解绑申请',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'list',
//       name: 'user_unbind:history_list',
//       component: _import('untied/list'),
//       meta: {
//         title: '解绑历史记录',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'review',
//       name: 'user_unbind:wait_check_list',
//       component: _import('untied/review'),
//       meta: {
//         title: '解绑审核',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   },

//   {
//     path: '/ecoupon-activity',
//     component: Layout,
//     name: 'ecoupon-activity:manage',
//     meta: {
//       title: '优惠券活动',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'index',
//       name: 'ecoupon-activity:index',
//       component: _import('ecoupon-activity/index'),
//       meta: {
//         title: '优惠券活动',
//         icon: 'dashboard'
//       }
//     }]
//   },
//   {
//     path: '/recommend_share',
//     component: Layout,
//     name: 'recommend_share',
//     meta: {
//       title: '推荐分享',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'recommend',
//       name: 'recommend_share:recommend',
//       component: _import('recommend_share/recommend'),
//       meta: {
//         title: '推荐管理',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'share',
//       name: 'recommend_share:share',
//       component: _import('recommend_share/share'),
//       meta: {
//         title: '分享管理',
//         icon: 'dashboard'
//       },
//       children: [{
//         name: 'recommend_share.goods.manage',
//         component: _import('recommend_share/goods_manage'),
//         path: 'goods_manage',
//         hidden: true,
//         meta: {
//           title: '分享专区商品详情',
//           icon: 'dashboard',
//           noCache: true
//         }
//       }]
//     },
//     {
//       name: 'recommend_share:static-recommend',
//       component: _import('recommend-share-static/static-recommend'),
//       path: 'static-recommend',
//       hidden: true,
//       meta: {
//         title: '推荐统计',
//         icon: 'dashboard',
//         noCache: true
//       }
//     },
//     {
//       name: 'recommend_share:detail-recommend',
//       component: _import('recommend-share-static/detail-recommend'),
//       path: 'detail-recommend',
//       hidden: true,
//       meta: {
//         title: '推荐明细',
//         icon: 'dashboard',
//         noCache: true
//       }
//     },
//     {
//       name: 'recommend_share:share-item-detail',
//       component: _import('recommend-share-static/share-item-detail'),
//       path: 'share-item-detail',
//       hidden: true,
//       meta: {
//         title: '分享明细',
//         icon: 'dashboard',
//         noCache: true
//       }
//     },
//     {
//       name: 'recommend_share:static-share',
//       component: _import('recommend-share-static/static-share'),
//       path: 'static-share',
//       hidden: true,
//       meta: {
//         title: '分享统计',
//         icon: 'dashboard',
//         noCache: true
//       }
//     },
//     {
//       name: 'recommend_share:detail-share',
//       component: _import('recommend-share-static/detail-share'),
//       path: 'detail-share',
//       hidden: true,
//       meta: {
//         title: '商品分享统计',
//         icon: 'dashboard',
//         noCache: true
//       }
//     },
//     {
//       name: 'recommend_share:user-detail-share',
//       component: _import('recommend-share-static/user-detail-share'),
//       path: 'user-detail-share',
//       hidden: true,
//       meta: {
//         title: '会员分享统计',
//         icon: 'dashboard',
//         noCache: true
//       }
//     }
//     ]
//   },
//   {
//     path: '/messagenotice',
//     component: Layout,
//     name: 'message_info:manage',
//     meta: {
//       title: '消息管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'index',
//       name: 'message_info:list',
//       component: _import('messagenotice/index'),
//       meta: {
//         title: '消息通知',
//         icon: 'dashboard'
//       }
//     },
//     {
//       path: 'new_template',
//       name: 'message_template:list',
//       component: _import('messagenotice/new_template'),
//       meta: {
//         title: '消息模板',
//         icon: 'dashboard'
//       }
//     }
//     ]
//   }

//   ]
// },

// {
//   title: '供应商管理',
//   name: 'provider:main',
//   children: [{
//     path: '/provider',
//     name: 'provider:manage',
//     component: Layout,
//     meta: {
//       title: '供应商管理',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'index',
//       name: 'provider:list',
//       component: _import('provider/index'),
//       meta: {
//         title: '供应商列表',
//         icon: 'dashboard'
//       }
//     }]
//   }]
// },
// {
//   title: '导出下载',
//   name: 'export_task',
//   children: [{
//     path: '/export',
//     name: 'export_task:manager',
//     component: Layout,
//     meta: {
//       title: '导出下载',
//       icon: 'dashboard'
//     },
//     children: [{
//       path: 'index',
//       name: 'export_task:list',
//       component: _import('export/index'),
//       meta: {
//         title: '导出下载列表',
//         icon: 'dashboard'
//       }
//     }]
//   }]
// }
]

let _routers = [

  {
    path: '/login',
    name: 'provider:login',
    component: _import('login/index'),
    hidden: true
  },

  {
    path: '/scan',
    name: 'scan',
    component: _import('login/scan'),
    hidden: true
  },

  {
    path: '',
    redirect: 'dashboard',
    hidden: true,
    component: Layout,
    children: [{
      path: 'dashboard',
      // component: _import('dashboard/index'),
      name: 'dashboard',
      meta: {
        title: '首页',
        icon: 'dashboard',
        noCache: true
      }
    }]
  }
]
constantRouterMap.forEach(router => {
  if (router.children) {
    _routers.push(...router.children)
  }
})

export default new Router({
  routes: _routers
})
